package com.application.library.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.application.library.R;

/**
 * recyclerView的header
 */

public class EmptyView extends RelativeLayout {

    public static final String TAG = "EmptyView";

    private ImageView ivEmptyIcon;
    private TextView tvEmptyTitle;

    public EmptyView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        ivEmptyIcon = (ImageView) findViewById(R.id.ivEmptyIcon);
        tvEmptyTitle = (TextView) findViewById(R.id.tvEmptyTitle);
    }

    /**
     * 设置图标和文字
     *
     * @param emptyDrawable
     * @param emptyText
     */
    public void setData(int emptyDrawable, String emptyText) {
        ivEmptyIcon.setImageResource(emptyDrawable);
        tvEmptyTitle.setText(emptyText);
    }

}